import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },

  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    name: 'Example',
    meta: { title: 'Example', icon: 'example' },
    children: [
      {
        path: 'table',
        name: 'Table',
        component: () => import('@/views/table/index'),
        meta: { title: 'Table', icon: 'table' }
      },
      {
        path: 'tree',
        name: 'Tree',
        component: () => import('@/views/tree/index'),
        meta: { title: 'Tree', icon: 'tree' }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    redirect: '/example/table',
    name: '用户管理',
    meta: { title: '用户管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '用户列表',
        component: () => import('@/views/user/list'),
        meta: { title: '用户列表', icon: 'table' }
      },
      {
        path: 'edit/:id',
        name: '修改用户信息',
        component: () => import('@/views/user/edit'),
        meta: { title: '编辑讲师', icon: 'tree' },
        hidden: true//讲师隐藏这个路由,就是不显示出来
      },
      // {
      //   path: 'edit/:id',//:id是一个占位符
      //   name: '修改用户信息',
      //   component: () => import('@/views/user/edit'),
      //   meta: { title: '编辑讲师', noCache: true }
      //   // hidden: true//讲师隐藏这个路由,就是不显示出来
      // }
    ]
  },
  {
    path: '/order',
    component: Layout,
    redirect: '/example/table',
    name: '订单管理',
    meta: { title: '订单管理', icon: 'example' },
    children: [
      {
        path: 'hotel/:id',
        name: '酒店订单管理',
        component: () => import('@/views/order/hotel'),
        meta: { title: '酒店订单管理', icon: 'table' }
      },
      {
        path: 'scenery/:id',
        name: '课程分类列表',
        component: () => import('@/views/order/scenery'),
        meta: { title: '景区订单管理', icon: 'table' }
      },

    ]
  },
  {
    path: '/scenery',
    component: Layout,
    redirect: '/example/table',
    name: '景区管理',
    meta: { title: '景区管理', icon: 'example' },
    children: [
      {
        path: 'add',
        name: '新增景区',
        component: () => import('@/views/scenery/add'),
        meta: { title: '新增景区', icon: 'tree' }
      },
      {
        path: 'list',
        name: '景区列表',
        component: () => import('@/views/scenery/list'),
        meta: { title: '景区列表', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: '编辑景区信息',
        component: () => import('@/views/scenery/add'),
        meta: { title: '编辑景区信息', noCache: true },
        hidden: true
      }

    ]
  },
  {
    path: '/hotel',
    component: Layout,
    redirect: '/example/table',
    name: '酒店管理',
    meta: { title: '酒店管理', icon: 'example' },
    children: [
      {
        path: 'add',
        name: '新增酒店',
        component: () => import('@/views/hotel/add'),
        meta: { title: '新增酒店', icon: 'tree' }
      },
      {
        path: 'list',
        name: '酒店分类列表',
        component: () => import('@/views/hotel/list'),
        meta: { title: '酒店列表', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: '编辑酒店信息',
        component: () => import('@/views/hotel/add'),
        meta: { title: '编辑酒店信息', noCache: true },
        hidden: true
      },
      {
        path: 'room/add',
        name: '新增酒店房间',
        component: () => import('@/views/hotel/room/add'),
        meta: { title: '新增酒店房间', icon: 'tree' }
      },
      {
        path: 'room/list',
        name: '酒店房间分类列表',
        component: () => import('@/views/hotel/room/list'),
        meta: { title: '酒店房间分类列表', icon: 'tree' }
      },
      {
        path: 'room/edit/:id',
        name: '编辑酒店房间信息',
        component: () => import('@/views/hotel/room/edit'),
        meta: { title: '编辑酒店房间信息', noCache: true },
        hidden: true
      },
    ]
  },

  // {
  //   path: '/subject',
  //   component: Layout,
  //   redirect: '/example/table',
  //   name: '课程分类管理',
  //   meta: { title: '课程分类管理', icon: 'example' },
  //   children: [
  //     {
  //       path: 'add',
  //       name: '新增课程管理',
  //       component: () => import('@/views/subject/add'),
  //       meta: { title: '新增课程分类管理', icon: 'tree' }
  //     },
  //     {
  //       path: 'list',
  //       name: '课程分类列表',
  //       component: () => import('@/views/subject/list'),
  //       meta: { title: '课程分类分类列表', icon: 'tree' }
  //     },

  //   ]
  // },
  // {
  //   path: '/course',
  //   component: Layout,
  //   redirect: '/example/table',
  //   name: '课程管理',
  //   meta: { title: '课程管理', icon: 'example' },
  //   children: [
  //     {
  //       path: 'add',
  //       name: '新增课程管理',
  //       component: () => import('@/views/course/add'),
  //       meta: { title: '新增课程管理', icon: 'tree' }
  //     },
  //     {
  //       path: 'list',
  //       name: '课程分类列表',
  //       component: () => import('@/views/course/list'),
  //       meta: { title: '课程分类列表', icon: 'tree' }
  //     },
  //     {
  //       path: 'add/:id',
  //       name: 'EduCourseInfoEdit',
  //       component: () => import('@/views/course/add'),
  //       meta: { title: '编辑课程基本信息', noCache: true },
  //       hidden: true
  //     },
  //     {
  //       path: 'chapter/:id',
  //       name: 'EduCourseChapterEdit',
  //       component: () => import('@/views/course/chapter'),
  //       meta: { title: '编辑课程大纲', noCache: true },
  //       hidden: true
  //     },
  //     {
  //       path: 'publish/:id',
  //       name: 'EduCoursePublishEdit',
  //       component: () => import('@/views/course/publish'),
  //       meta: { title: '发布课程', noCache: true },
  //       hidden: true
  //     },

  //   ]
  // },
  // {
  //   path: '/sta',
  //   component: Layout,
  //   redirect: '/example/table',
  //   name: '统计分析管理',
  //   meta: { title: '统计分析管理', icon: 'example' },
  //   children: [
  //     {
  //       path: 'add',
  //       name: '生成统计数据',
  //       component: () => import('@/views/sta/add'),
  //       meta: { title: '生成统计数据', icon: 'tree' }
  //     },
  //     {
  //       path: 'list',
  //       name: '展示统计数据',
  //       component: () => import('@/views/sta/list'),
  //       meta: { title: '展示统计数据', icon: 'tree' }
  //     },

  //   ]
  // },
  {
    path: '/charsta',
    component: Layout,
    redirect: '/example/table',
    name: '统计管理',
    meta: { title: '统计管理', icon: 'example' },
    children: [
      {
        path: 'add',
        name: '生成统计数据',
        component: () => import('@/views/charsta/add'),
        meta: { title: '生成统计数据', icon: 'tree' }
      },
      {
        path: 'userSta',
        name: '统计注册人数',
        component: () => import('@/views/charsta/userSta'),
        meta: { title: '统计注册人数', icon: 'tree' }
      },
      {
        path: 'hotelSta',
        name: '统计酒店入住人数',
        component: () => import('@/views/charsta/hotelSta'),
        meta: { title: '统计酒店入住人数', icon: 'tree' }
      },
      {
        path: 'scenerySta',
        name: '统计景区下单人数',
        component: () => import('@/views/charsta/scenerySta'),
        meta: { title: '统计景区下单人数', icon: 'tree' }
      },

    ]

  },

  {
    path: '/dict',
    component: Layout,
    redirect: '/example/table',
    name: '字典管理',
    meta: { title: '字典管理', icon: 'example' },
    children: [
      {
        path: 'edit/:id',
        name: '编辑酒店类型',
        component: () => import('@/views/dict/hotelDict'),
        meta: { title: '编辑酒店类型', noCache: true },
        hidden: true
      },
      {
        path: 'hotelDict',
        name: '新增酒店类型',
        component: () => import('@/views/dict/hotelDict'),
        meta: { title: '新增酒店类型', noCache: true },
        hidden: true
      },
      {
        path: 'HotelTypeList',
        name: '酒店类型列表',
        component: () => import('@/views/dict/HotelTypeList'),
        meta: { title: '酒店类型列表', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: '编辑房间类型',
        component: () => import('@/views/dict/hotelRoomDict'),
        meta: { title: '编辑房间类型', noCache: true },
        hidden: true
      },
      {
        path: 'hotelRoomDict',
        name: '新增房间类型',
        component: () => import('@/views/dict/bedTypeList'),
        meta: { title: '新增景区', icon: 'tree' }
      },
      {
        path: 'cityProvinceList',
        name: '城市省级字典',
        component: () => import('@/views/dict/cityProvinceList'),
        meta: { title: '城市字典', icon: 'tree' },
      },
      {
        path: 'cityProvinceAdd',
        name: '新增省',
        component: () => import('@/views/dict/cityProvinceAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },
      {
        path: 'cityProvinceEdit/:name',
        name: '修改省',
        component: () => import('@/views/dict/cityProvinceAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },


      {
        path: 'cityCityList/:name',
        name: '城市市级字典',
        component: () => import('@/views/dict/cityCityList'),
        meta: { title: '城市字典', icon: 'tree' },
        hidden: true
      },
      {
        path: 'cityCityAdd/:cityName',
        name: '新增市',
        component: () => import('@/views/dict/cityCityAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },
      {
        path: 'cityCityEdit/:name',
        name: '修改市',
        component: () => import('@/views/dict/cityCityAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },


      {
        path: 'cityCounterList/:name',
        name: '城市区级字典',
        component: () => import('@/views/dict/cityCounterList'),
        meta: { title: '城市字典', icon: 'tree' },
        hidden: true
      },
      {
        path: 'cityCounterAdd/:cityName',
        name: '新增市',
        component: () => import('@/views/dict/cityCounterAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },
      {
        path: 'cityCounterEdit/:name',
        name: '修改市',
        component: () => import('@/views/dict/cityCounterAdd'),
        meta: { title: '生成统计数据', icon: 'tree' },
        hidden: true
      },

    ]
  },



  {
    path: '/form',
    component: Layout,
    children: [
      {
        path: 'index',
        name: 'Form',
        component: () => import('@/views/form/index'),
        meta: { title: 'Form', icon: 'form' }
      }
    ]
  },

  {
    path: '/nested',
    component: Layout,
    redirect: '/nested/menu1',
    name: 'Nested',
    meta: {
      title: 'Nested',
      icon: 'nested'
    },
    children: [
      {
        path: 'menu1',
        component: () => import('@/views/nested/menu1/index'), // Parent router-view
        name: 'Menu1',
        meta: { title: 'Menu1' },
        children: [
          {
            path: 'menu1-1',
            component: () => import('@/views/nested/menu1/menu1-1'),
            name: 'Menu1-1',
            meta: { title: 'Menu1-1' }
          },
          {
            path: 'menu1-2',
            component: () => import('@/views/nested/menu1/menu1-2'),
            name: 'Menu1-2',
            meta: { title: 'Menu1-2' },
            children: [
              {
                path: 'menu1-2-1',
                component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
                name: 'Menu1-2-1',
                meta: { title: 'Menu1-2-1' }
              },
              {
                path: 'menu1-2-2',
                component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
                name: 'Menu1-2-2',
                meta: { title: 'Menu1-2-2' }
              }
            ]
          },
          {
            path: 'menu1-3',
            component: () => import('@/views/nested/menu1/menu1-3'),
            name: 'Menu1-3',
            meta: { title: 'Menu1-3' }
          }
        ]
      },
      {
        path: 'menu2',
        component: () => import('@/views/nested/menu2/index'),
        meta: { title: 'menu2' }
      }
    ]
  },

  {
    path: 'external-link',
    component: Layout,
    children: [
      {
        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
        meta: { title: 'External Link', icon: 'link' }
      }
    ]
  },

  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
